//
//  WeChatRedEnvolopParamQueue.m
//  MonKeyDylib
//
//  Created by farawei on 2018/6/4.
//  Copyright © 2018年 Times property co., LTD. All rights reserved.
//

#import "WeChatRedEnvolopParamQueue.h"

@interface WeChatRedEnvolopParamQueue()
@property (nonatomic, strong) NSMutableArray *queue;
@end

@implementation WeChatRedEnvolopParamQueue

+(instancetype)shareQueue {
    static WeChatRedEnvolopParamQueue *queue = nil;
    static dispatch_once_t onceToken;
    dispatch_once(&onceToken, ^{
        queue = [[WeChatRedEnvolopParamQueue alloc] init];
    });
    return queue;
    
}

- (instancetype)init {
    if (self = [super init]) {
        _queue = [NSMutableArray array];
    }
    return self;
}

- (void) enqueue:(NSMutableDictionary *)param {
    [self.queue addObject:param];
}

- (NSMutableDictionary *)getqueue {
    if (self.queue.count == 0 || !self.queue.firstObject) {
        return nil;
    }
    NSMutableDictionary *param = self.queue.firstObject;
    [self.queue removeObjectAtIndex:0];
    return param;
}

@end
